﻿

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>修改返修</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
</head>
<body>
    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
        <div class="layui-form-item">
            <label class="layui-form-label">返修单号</label>
            <div class="layui-input-inline">
                <input type="text" name="txt_fxdh" id="txt_fxdh" readonly="readonly" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">预收单号</label>
            <div class="layui-input-inline">
                <input type="text" name="txt_ysdbh" id="txt_ysdbh" readonly="readonly" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所属单号</label>
            <div class="layui-input-inline">
                <input type="text" name="txt_djbh" id="txt_djbh" readonly="readonly" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">返修名称</label>
            <div class="layui-input-inline">
                <input type="text" name="txt_name" id="txt_name" readonly="readonly" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">返修款号</label>
            <div class="layui-input-inline">
                <input type="text" name="txt_kh" id="txt_kh" readonly="readonly" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">返修数量</label>
            <div class="layui-input-inline">
                <input type="number" min="1" name="txt_sl" id="txt_sl" autocomplete="off" class="layui-input stock">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">返修原因</label>
            <div class="layui-input-inline">
                <textarea name="txt_remark" style="width:400px" rows="8" id="txt_remark" placeholder="填写原因" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">返修图片</label>
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="test-upload-more">选择图片</button>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-upload">
                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                    <div class="layui-upload-list" id="test-upload-more-list"></div>
                    <input id="pic_url" type='hidden'>
                </blockquote>
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="提交">
        </div>
    </div>

    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../layuiadmin/js/jquery.min2.1.4.js"></script>
    <script src="../../layuiadmin/js/jshelp.js"></script>
    <script>
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(decodeURI(r[2])); return null; //返回参数值
        }
        var editid = getUrlParam('editid');
     
        var urls = '';
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload'], function () {
            var $ = layui.$
                , form = layui.form
                , upload = layui.upload;
          
            //加载修改信息
            $.ajax({
                url: 'ashx/list.ashx?type=getlist_byid&editid=' + editid,
                type: 'GET',
                success: function (data) {
                    var str = "";
                    for (var i = 0; i < data.data.length; i++) {
                        $("#txt_fxdh").val(data.data[i].rebh);
                        $("#txt_ysdbh").val(data.data[i].ysdh);
                        $("#txt_djbh").val(data.data[i].orderbh);
                        $("#txt_name").val(data.data[i].name);
                        $("#txt_kh").val(data.data[i].kh);
                        $("#txt_sl").val(data.data[i].sl);
                        $("#txt_remark").val(data.data[i].remark);
                    }
                    //加载图片
                    var html_pic = '';
                    for (var k = 0; k < data.data_pic.length; k++) {
                        //html_pic += "<img src=" + data.data_pic[k].picurl + " alt=" + file.name + " class='layui-upload-img'>";
                        html_pic += "<img src=" + data.data_pic[k].picurl + " class='layui-upload-img'>";
                        urls += data.data_pic[k].picurl + "|";
                    }
                    $('#test-upload-more-list').html(html_pic);
                }
            })

            //多图片上传
            upload.render({
                elem: '#test-upload-more'
                , url: '../../ashx/uploads_img.ashx'
                , multiple: true
                , before: function (obj) {
                    //预读本地文件示例，不支持ie8
                    obj.preview(function (index, file, result) {
                        $('#test-upload-more-list').append('<img src="' + result + '" alt="' + file.name + '" class="layui-upload-img">')
                    });
                }
                , done: function (res) {
                    //上传完毕
                    if (res.code === "100") {
                        layer.msg(res.msg);
                        //$(this.item).prev("div").children("input").val(res.url)
                        urls += res.url + "|";
                    } else {
                        layer.msg(res.msg);
                    }
                }
            });
           
        })
    </script>
</body>
</html>